﻿#ifndef _FD_DATASET_COMMONDEF_H_
#define _FD_DATASET_COMMONDEF_H_ 

#include "udataset/dll_cfg.h"

namespace FD
{
	namespace Utility
	{
		namespace Dataset
		{
			//元数据表
			//#define TAB_METAINFO		"FD_METAINFO"

			//#define COL_TID				"TID"
			//#define COL_SR				"SR"
			//#define COL_TAB_NAME		"Tab_Name"
			//#define COL_TAB_TYPE		"Tab_Type"

			#define COL_AABB_Radius	"AABB_Radius"

			//#define COL_XMIN			"XMin"
			//#define COL_XMAX			"XMax"
			//#define COL_YMIN			"YMin"
			//#define COL_YMAX			"YMax"
			//#define COL_ZMIN			"ZMin"
			//#define COL_ZMAX			"ZMax"
			//#define COL_ALT_MODE		"Alt_Mode"
			//#define COL_ALT_VAL			"Alt_Val"
			//#define COL_VERSION			"Version"


			//模型表
			//#define TAB_INST_PREFIX		"FD_INST_"

			//#define COL_INST_ID			"INST_ID"
			//#define COL_INST_Name		"INST_Name"
			//#define COL_XPos			"XPos"
			//#define COL_YPos			"YPos"
			//#define COL_ZPos			"ZPos"
			//#define COL_XLocalScale		"XLocalScale"
			//#define COL_YLocalScale		"YLocalScale"
			//#define COL_ZLocalScale		"ZLocalScale"
			//#define COL_XLocalRotate	"XLocalRotate"
			//#define COL_YLocalRotate	"YLocalRotate"
			//#define COL_ZLocalRotate	"ZLocalRotate"


			//模型库
			#define TAB_MD_DB			"FD_MDB_GENERAL"

			//#define COL_MD_ID			"MD_ID"
			//#define COL_MD_Name			"MD_Name"
			//#define COL_MD_MeshData		"MD_MeshData"
			//#define COL_MD_ThumbTexData	"MD_ThumbTexData"
			//#define COL_MD_OrigTexData	"MD_OrigTexData"
			//#define COL_XLocalPos		"XLocalPos"
			//#define COL_YLocalPos		"YLocalPos"
			//#define COL_ZLocalPos		"ZLocalPos"

			//八叉树
			#define TAB_OCT_PREFIX		"FD_OCT_"

			#define COL_OCT_CODE		"OCT_Code"
			#define COL_OCT_DATA		"OCT_Data"
			//锁表
			#define TAB_MDS_LOCK		"FD_MDS_LOCK"

			#define PREFIX_MDB			"FD_MDB_"
			#define COL_FDID	"FD_ID"
			#define COL_MESHNAME "MeshName"
			#define COL_MESHDATA "MeshData"
			#define COL_MESHBOUND "MeshBound"
			#define COL_FDMATRIX "LocalMatrix"

			#define COL_MODELNAME "ModelName"
			#define COL_MDBID "MDBID"
			#define COL_MODEPOINT "ModelPoint"

			#define PREFIX_TEXTURE_REF	"FD_TEXTURE_REF_"
			#define COL_MESHID "MeshID"
			#define	COL_MDID "MDID"
			#define COL_TEXTUREID "TextureID"

			#define PREFIX_TEXTURE		"FD_TEXTURE_"
			#define COL_ORIGDATA "OrigData"
			#define COL_THUMBDATA "ThumbData"
			#define COL_TEXTURENAME "TextureName"

			#define PREFIX_MD_TREE	"FD_MD_TREE_"
			#define COL_PARENTID	"ParentID"
			#define COL_NODEID		"NodeID"
			#define COL_NODENAME	"NodeName"
			#define COL_NODEBOUND	"NodeBound"
			#define COL_NODEGUID	"NodeGuid"
			#define COL_NODEGUID2	"NodeGuid2"
			#define COL_PARENTNODEGUID "ParentNodeGuid"
			#define	COL_3DTILENO "Tile3dNo"
			#define	COL_TREEFDID "TreeFDID"
			#define COL_TREEPID "TreePID"

			#define PREFIX_MD_ATTR	"FD_MD_ATTR_"
			#define COL_NODEATTR "NodeAttr"

			#define TAB_LINEAR "FD_LINEAR_REF_SYS"
			#define COL_EVENT "Event"
			#define COL_EVENTTYPE "EventType"
			#define COL_DATASETID "DatasetID"
			#define COL_FEATUREID "FeatureID"
			#define COL_START_POS "StartPos"
			#define COL_END_POS "EndPos"

			#define TAB_LOCK "FD_DATASET_LOCK"

			#define PREFIX_MODEL "FD_MODEL_"
			#define PREFIX_MODEL_GEOM "FD_MODEL_GEOM_"
			#define PREFIX_MODEL_METAINFO "FD_MODEL_METAINFO_"
			#define PREFIX_MODEL_SEMANTIC "FD_MODEL_SEMANTIC_"

			#define PREFIX_MD_METAINFO "FD_MDB_METAINFO_"
			#define PREFIX_PMD_TREE	"FD_PMD_TREE_"
			#define PREFIX_PMD_ATTR	"FD_PMD_ATTR_"

			#define PREFIX_CMD_TREE	"FD_CMD_TREE_"
			#define PREFIX_CMD_ATTR	"FD_CMD_ATTR_"

			#define PREFIX_MD_TREE_METAINFO "FD_MD_TREE_METAINFO_"
			#define PREFIX_PMD_TREE_METAINFO "FD_PMD_TREE_METAINFO_"

			#define COL_COMPGUID "CompGuid"
			#define COL_COMPNAME "CompName"
			#define COL_COMPTAG "CompTag"
			#define COL_PROINDEX "ProIndex"
			#define	COL_FLOORFDID "FloorFDID" 
			#define COL_FLOORGUID "FloorGuid"
			#define COL_FLOORNAME "FloorName"
			#define COL_LONGNAME "LongName"
			#define COL_COMPOSITIONTYPE "CompositionType"
			#define COL_ELEVATION "Elevation"

			#define COL_COMPTYPPREDEFINEDTYPE "CompTypePredefinedType"
			#define COL_COMPTYPEID "CompTypeID"
			#define COL_COMPTYPENAME "CompTypeName"
			#define COL_COMPTYPEGUID "CompTypeGuid"
			#define COL_COMPTYPETAG "CompTypeTag"

			#define COL_OBJECTTYPE "ObjectType"
			#define COL_OBJECTPLACEMENT "ObjectPlacement"
			
			#define COL_LAYERGUID "LayerGuid"
			#define COL_LAYERNAME "LayerName"
			#define COL_PROPERTYSETGUID "PropertySetGuid"
			#define COL_PROPERTYNAME "PropertyName"
			#define COL_PROPERTYKEY "PropertyKey"
			#define COL_PROPERTYVALUE "PropertyValue"
			#define COL_PROPERTYSETNAME "PropertySetName"
			#define COL_OBJECTGUID "ObjectGuid"
			#define COL_OPENINGELEMGUID "OpeningElemGuid"
			#define	COL_OPENINGELEMNAME "OpeningElemName"
			#define COL_HASOPENINGELEM "HasOpeningElem"
			#define COL_REFTYPE "RefTypeID"

			#define COL_COMPFDID "CompFDID"
			#define COL_COMPTYPEFDID "CompTypeFDID"
			#define COL_OBJECTFDID "ObjectFDID"
			#define COL_OPENINGFDID "OpenFDID"
			#define COL_PROFDID "ProFDID"
			#define COL_COMPINFO "CompInfo"

			#define PREFIX_PMD_COMPTYPE "FD_PMD_COMPTYPE_"
			#define PREFIX_PMD_LAYER "FD_PMD_LAYER_"
			#define PREFIX_PMD_PROPERTYSET_REF "FD_PMD_PROPERTYSETREF_"
			#define PREFIX_PMD_PROPERTYSET "FD_PMD_PROPERTYSET_"
			#define PREFIX_PMD_OPENINGELEM "FD_PMD_OPENINGELEM_"
			#define PREFIX_PMD_COMPTYPE_METAINFO "FD_PMD_COMPTYPE_METAINFO_"
			#define PREFIX_PMD_FLOOR "FD_PMD_FLOOR_"
			
			#define PREFIX_PMD_PERMISSION "FD_PMD_PERMISSION_"
			#define COL_AUTHOR "Author"		

			#define PREFIX_PMD_TIME "FD_PMD_TIME_"
			#define COL_TASKNAME "TaskName"
			#define COL_PLAN_S "PlanStart"
			#define COL_PLAN_E "PlanEnd"
			#define COL_ACTUAL_S "ActualStart"
			#define COL_ACTUAL_E "ActualEnd"
			#define COL_TASKTYPE "TaskType"
			#define COL_TASKGUID "TaskGuid"
			#define COL_TOTALPRICE "TotalPrice"
			#define COL_PARENTTASKID "ParentTaskID"
			#define COL_TASKDESC "TaskDescription"
			#define COL_TASKACTIVE "TaskActive"
			#define COL_TASK_CHILDNUM "TaskChildNum"
			#define COL_TASK_PERCENT "TaskPercent"

			#define COL_GBCODE	"GBCODE"
			enum SameNameMode
			{
				SNM_JUMP,
				SNM_ADD,
			};

			struct FD_XDataset_Export SimpleBound
			{
				Real minX;
				Real minY;
				Real minZ;

				Real maxX;
				Real maxY;
				Real maxZ;

				SimpleBound()
				{
					minX = 0;
					minY = 0;
					minZ = 0;

					maxX = 0;
					maxY = 0;
					maxZ = 0;
				}

				void merge(const SimpleBound& rhs)
				{
					maxX = std::max( maxX, rhs.maxX );
					maxY = std::max( maxY, rhs.maxY );
					maxZ = std::max( maxZ, rhs.maxZ );

					minX = std::min( minX, rhs.minX );
					minY = std::min( minY, rhs.minY );
					minZ = std::min( minZ, rhs.minZ );
				}
			};
		}
	}
}

#endif
